package me.flyray.bsin.domain.enums;

import com.fasterxml.jackson.annotation.JsonCreator;

public enum WalletTag {

    /** 存入 */
    DEPOSIT("DEPOSIT", "充值存款"),
    
    /** 归集 */
    GATHER("GATHER", "归集"),
    
    /** 提现 */
    WITHDRAW("WITHDRAW", "提现"),
    
    /** 结算 */
    SETTLEMENT("SETTLEMENT", "结算");

    private String code;

    private String desc;

    WalletTag(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /** Json 枚举序列化 */
    @JsonCreator
    public static WalletTag getInstanceById(String id) {
        if (id == null) {
            return null;
        }
        for (WalletTag status : values()) {
            if (id.equals(status.getCode())) {
                return status;
            }
        }
        return null;
    }

}
